//
//  YZImageListCell.m
//  Car
//
//  Created by dllo on 15/11/7.
//  Copyright © 2015年 岳明. All rights reserved.
//

#import "YZImageListCell.h"
#import "YZLSeriesListModel.h"
#import "Macro.h"
#import <UIImageView+WebCache.h>
#import "YZLImageListModel.h"

@interface YZImageListCell ()

@property (nonatomic, strong) UIImageView *firstImageView;
@property (nonatomic, strong) UIImageView *secondImageView;
@property (nonatomic, strong) UIImageView *thirdImageView;

@end

@implementation YZImageListCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.firstImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:self.firstImageView];
        
        self.secondImageView= [[UIImageView alloc] init];
        [self.contentView addSubview:self.secondImageView];
        
        self.thirdImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:self.thirdImageView];
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    self.firstImageView.frame = CGRectMake(20, 5, (kWidth - 85) / 3, self.contentView.frame.size.height - 10);
    
    self.secondImageView.frame = CGRectMake(25 + (kWidth - 40) / 3, 5, (kWidth - 85) / 3, self.contentView.frame.size.height - 10);
    
    self.thirdImageView.frame = CGRectMake(30 + (kWidth - 40) * 2 / 3, 5, (kWidth - 85) / 3, self.contentView.frame.size.height - 10);

}

- (void)setModel:(YZLSeriesListModel *)model {
    if (_model != model) {
        _model = model;
    }
    [self.firstImageView sd_setImageWithURL:[NSURL URLWithString:[[model.imageList objectAtIndex:0] imageUrl]] placeholderImage:[UIImage imageNamed:@"D0"]];
    [self.secondImageView sd_setImageWithURL:[NSURL URLWithString:[[model.imageList objectAtIndex:1]imageUrl]] placeholderImage:[UIImage imageNamed:@"D0"]];
    [self.thirdImageView sd_setImageWithURL:[NSURL URLWithString:[[model.imageList objectAtIndex:2]imageUrl]] placeholderImage:[UIImage imageNamed:@"D0"]];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
